<?php
include_once($_SERVER['DOCUMENT_ROOT'] . '/mba/models/MBA.php');
include_once($_SERVER['DOCUMENT_ROOT'] . '/mba/controls/MBAController.php');
?>
<!doctype html>
<html>
    <head>
        <meta charset="utf-8">
        <title>Thêm máy biến áp</title>
        <style type="text/css">
        </style><link href="css/style.css" rel="stylesheet" type="text/css">
        <!--<link href="../SpryAssets/SpryMenuBarHorizontal.css" rel="stylesheet" type="text/css">
        <script src="../SpryAssets/SpryMenuBar.js" type="text/javascript"></script>-->

        <!--phan khai bao cho toggler-->

        <script src="jquery-ui-1.10.3.custom/development-bundle/jquery-1.9.1.js"></script>
        <script src="jquery-ui-1.10.3.custom/development-bundle/ui/jquery.ui.effect.js"></script>
        <script src="jquery-ui-1.10.3.custom/development-bundle/ui/jquery.ui.effect-blind.js"></script>
        <script src="jquery-ui-1.10.3.custom/development-bundle/ui/jquery.ui.effect-explode.js"></script>
        <script src="jquery-ui-1.10.3.custom/development-bundle/ui/jquery.ui.effect-shake.js"></script>
        <script>
            $(function() {
                // run the currently selected effect
                function runEffect() {
                    // run the effect
                    $("#effect").toggle("explode");
                }
                ;

                function runEffect2() {
                    // get effect type from
                    var selectedEffect = "blind";
                    // run the effect
                    $("#effect2").toggle(selectedEffect);
                }
                ;
                // set effect from select menu value
                $("#thongtinchitiet").click(function() {
                    runEffect();
                    return false;
                });
                $("#thongtinkythuat").click(function() {
                    runEffect2();
                    return false;
                });
            });

        </script>
        <!--phan khai bao cho toggler-->
        <!--phan khai bao cho datepicker-->
        <link rel="stylesheet" href="../jquery-ui-1.10.3.custom/development-bundle/themes/redmond/jquery-ui.css">
        <script src="jquery-ui-1.10.3.custom/development-bundle/ui/jquery.ui.core.js"></script>	
        <script src="jquery-ui-1.10.3.custom/development-bundle/ui/jquery.ui.datepicker.js"></script>
        <script src="jquery-ui-1.10.3.custom/development-bundle/ui/i18n/jquery.ui.datepicker-vi.js"></script>
        <script src="jquery-ui-1.10.3.custom/development-bundle/ui/jquery.ui.widget.js"></script>
        <script>

            $(function() {
                // bat button ngay, thang
                $(".datepicker").datepicker({
                    changeMonth: true,
                    changeYear: true
                });
                // chon ngon ngu la tieng viec
                $(".datepicker").datepicker($.datepicker.regional[ "vi" ]);
                // hieu ung slikedown
                $(".datepicker").datepicker();
                $("#slikeDown").change(function() {
                    $(".datepicker").datepicker("option", "showAnim", $(this).val());
                });
            });
            $(".datepicker").datepicker();
        </script>

        <!-- het phan khai bao cho datepicker-->


    </head>

    <body>
        <!--// thanh menu-->
		<p></p>
        <div class="bodyStyle">
            <form id="form1" name="themdonvi" method="post" >
                <div >
                    <div class="toggoler">
                        <table width="1000" align="center">
                            <tr>
                                <td colspan="5" class="TableHeader" >Thêm máy biến áp</td>
                            </tr>
                            <tr class="TableField">
                                <td width="168" class="TableField3" >Số N0</td>
                                <td width="423" class="TableField3"><input type="text" name="txtson0" id="txtson0">
                                    <span class="error"><?php echo $son0Err; ?></span></td>
                                <td width="141" class="TableField3">Loại điện áp (U)</td>
                                <td colspan="2" class="TableField3"><select name="txtmadienap" id="txtmadienap">
                                        <?php
                                        $db = new database();
                                        $db->setQuery("SELECT * FROM loai_dien_ap");
                                        $result = $db->fetchAll();
                                        while ($rows = mysql_fetch_array($result)) {
                                            echo "<option value=\"" . $rows['MA_DIEN_AP'] . "\">" . $rows['CAP_DIEN_AP'] . "</option>";
                                        }
                                        ?>
                                    </select></td>
                            </tr>
                            <tr>
                                <td class="TableField3">Công suất (S)</td>
                                <td class="TableField3"><input type="text" name="txtcongsuat" id="txtcongsuat"><span class="error"><?php echo $congsuatErr; ?></span></td>
                                <td class="TableField3">Loại máy</td>
                                <td colspan="2" class="TableField3"><select name="txtmaloaimay" id="txtmaloaimay">
                                        <?php
                                        $db = new database();
                                        $db->setQuery("SELECT * FROM loai_may");
                                        $result = $db->fetchAll();
                                        while ($rows = mysql_fetch_array($result)) {
                                            echo "<option value=\"" . $rows['MA_LOAI'] . "\">" . $rows['TEN_LOAI'] . "</option>";
                                        }
                                        ?>
                                    </select></td>

                                <!--lay ve ma dien ap tu loai dien ap duoc chon-->
                            </tr>
                            <tr>
                                <td class="TableField3">Loại dầu</td>
                                <td class="TableField3"><select name="txtmaloaidau" id="txtmaloaidau">
                                        <?php
                                        $db = new database();
                                        $db->setQuery("SELECT * FROM loai_dau");
                                        $result = $db->fetchAll();
                                        while ($rows = mysql_fetch_array($result)) {
                                            echo "<option value=\"" . $rows['MA_LOAI_DAU'] . "\">" . $rows['TEN_LOAI_DAU'] . "</option>";
                                        }
                                        ?>
                                    </select>
                                    khác
                                    <input name="txtloaidau2" type="text" id="txtloaidau2"></td>
                                <td class="TableField3">Nhà sản xuất</td>
                                <td colspan="2" class="TableField3"><select name="txtmanhasx" id="txtmanhasx">
                                        <?php
                                        $db = new database();
                                        $db->setQuery("SELECT * FROM nha_sx");
                                        $result = $db->fetchAll();
                                        while ($rows = mysql_fetch_array($result)) {
                                            echo "<option value=\"" . $rows['MA_NSX'] . "\">" . $rows['TEN_NSX'] . "</option>";
                                        }
                                        ?>
                                    </select></td>
                            </tr>
                            <tr>
                                <td class="TableField3">Tên đơn vị</td>
                                <td class="TableField3"><select name="txtmadonvi" id="txtmadonvi">
                                        <?php
                                        $db = new database();
                                        $db->setQuery("SELECT * FROM don_vi");
                                        $result = $db->fetchAll();
                                        while ($rows = mysql_fetch_array($result)) {
                                            echo "<option value=\"" . $rows['MA_DON_VI'] . "\">" . $rows['TEN_DON_VI'] . "</option>";
                                        }
                                        ?>
                                    </select></td>
                                <td class="TableField3">Nước sản xuất</td>
                                <td colspan="2" class="TableField3"><select name="txtnuocsx" id="txtnuocsx">
                                        <?php
                                        $db = new database();
                                        $db->setQuery("SELECT * FROM nuoc_sx");
                                        $result = $db->fetchAll();
                                        while ($rows = mysql_fetch_array($result)) {
                                            echo "<option value=\"" . $rows['TEN_NUOC_SX'] . "\">" . $rows['TEN_NUOC_SX'] . "</option>";
                                        }
                                        ?>
                                    </select></td>
                            </tr>
                            <tr>
                                <td class="TableField3">Ngày chuyển đến</td>
                                <td class="TableField3"><input name="txtngaychuyenden"  type="text"  class="datepicker" size="12" maxlength="12"  readonly="readonly"></td>
                                <td colspan="3" class="TableField3">&nbsp;</td>
                            </tr>
                        </table>
                        <table width="1000" border="0" align="center" cellspacing="1">
                            <tr>
                                <td colspan="4" class="TableHeader" style="cursor: pointer" id="thongtinchitiet" >Thông tin chi tiết</td>
                            </tr>
                        </table>
                    </div>
                </div>
                <div class="toggler">
                    <div id="effect"  ><!--style="display:none"-->
                        <table width="1000" border="0" align="center" cellspacing="1" class="toggler">

                            <tr>
                                <td width="132" class="TableField3">MSTS</td>
                                <td width="378" class="TableField3"><input type="text" name="txtmsts" id="txtmsts"></td>
                                <td width="154" class="TableField3">Ngày vận hành</td>
                                <td width="323" class="TableField3"><input name="txtngayvanhanh"  type="text"  class="datepicker" size="12" maxlength="12"  readonly="readonly"></td>
                            </tr>
                            <tr>
                                <td class="TableField3">Tên trạm</td>
                                <td class="TableField3"><select name="txtmatram" id="txtmatram">
                                        <option value="" selected>----</option>
                                        <?php
                                        $db = new database();
                                        $db->setQuery("SELECT * FROM tram");
                                        $result = $db->fetchAll();
                                        while ($rows = mysql_fetch_array($result)) {
                                            echo "<option value=\"" . $rows['MA_TRAM'] . "\">" . $rows['TEN_TRAM'] . "</option>";
                                        }
                                        ?>
                                    </select></td>
                                <td class="TableField3">Ngày ngưng vận hành</td>
                                <td class="TableField3"><input name="txtngayngungvanhanh"  type="text"  class="datepicker" size="12" maxlength="12"  readonly="readonly"></td>
                            </tr>
                            <tr>
                                <td class="TableField3">Tình trạng máy</td>
                                <td class="TableField3"><select name="txttinhtrangmay" id="txttinhtrangmay">
                                        <option value="" selected>----</option>
                                        <?php
                                        $db = new database();
                                        $db->setQuery("SELECT * FROM tinh_trang_may");
                                        $result = $db->fetchAll();
                                        while ($rows = mysql_fetch_array($result)) {
                                            echo "<option value=\"" . $rows['TEN_TINH_TRANG_MAY'] . "\">" . $rows['TEN_TINH_TRANG_MAY'] . "</option>";
                                        }
                                        ?>
                                    </select></td>
                                <td class="TableField3">Ngày đại tu</td>
                                <td class="TableField3"><input name="txtngaydaitu"   class="datepicker" size="12" maxlength="12"  readonly="readonly"></td>
                            </tr>
                            <tr>
                                <td class="TableField3">Có tình trạng từ ngày</td>
                                <td class="TableField3"><input name="txtngaycotinhtrang"  type="text"  class="datepicker" size="12" maxlength="12"  readonly="readonly"></td>
                                <td class="TableField3">Diển giải tình trạng</td>
                                <td class="TableField3"><textarea name="txtdiengiaitt" id="txtdiengiaitt" cols="40" rows="3"></textarea></td>
                            </tr>
                            <tr>
                                <td class="TableField3">Ghi chú</td>
                                <td class="TableField3"><textarea name="txtghichu" id="txtghichu" cols="40" rows="3"></textarea></td>
                                <td class="TableField3">Nhân xét</td>
                                <td class="TableField3"><textarea name="txtnhanxet" id="txtnhanxet" cols="40" rows="3"></textarea></td>
                            </tr>
                        </table>
                    </div>
                </div>
                <table width="1000" border="0" align="center" cellspacing="1">
                    <tr>
                        <td colspan="4" class="TableHeader" style="cursor: pointer" id="thongtinkythuat" >Thông tin kỹ thuật</td>
                    </tr>
                </table>
                <div class="toggler">
                    <div id="effect2"  ><!--style="display:none"-->
                        <table width="1000" border="0" align="center" cellspacing="1">
                            <tr>
                                <td class="TableField3">Chiều dài</td>
                                <td class="TableField3"><input type="text" name="txtchieudai" id="txtchieudai"></td>
                                <td class="TableField3">Ruột máy</td>
                                <td class="TableField3"><input type="text" name="txtruotmay" id="txtruotmay"></td>
                            </tr>
                            <tr>
                                <td class="TableField3">Chiều rộng</td>
                                <td class="TableField3"><input type="text" name="txtchieurong" id="txtchieurong"></td>
                                <td class="TableField3">Đầu máy</td>
                                <td class="TableField3"><input type="text" name="txtdaumay" id="txtdaumay"></td>
                            </tr>
                            <tr>
                                <td class="TableField3">Chiều cao</td>
                                <td class="TableField3"><input type="text" name="txtchieucao" id="txtchieucao"></td>
                                <td class="TableField3">Thông số đo</td>
                                <td class="TableField3"><input type="text" name="txtthongsodo" id="txtthongsodo"></td>
                            </tr>
                            <tr>
                                <td class="TableField3">Năm sản xuất</td>
                                <td class="TableField3"><select name="txtnamsx" id="txtnamsx">
                                        <option value="" selected>----</option>
                                        <?php
                                        for ($n = 1900; $n < 2090; $n++) {
                                            echo "<option value=\"" . $n . "\">" . $n . "</option>";
                                        }
                                        ?>
                                    </select></td>
                                <td class="TableField3">Năm nhập về</td>
                                <td class="TableField3"><select name="txtnamnhapve" id="select13">
                                        <option value="" selected>----</option>
                                        <?php
                                        for ($n = 1900; $n < 2090; $n++) {
                                            echo "<option value=\"" . $n . "\">" . $n . "</option>";
                                        }
                                        ?>
                                    </select></td>
                            </tr>
                        </table>
                    </div>
                </div>
                <p>&nbsp;</p>
                <div class="btn">
                    <input type="submit" name="btnthemmba" id="btnthemmba" value="Thêm máy biến áp">
                    <input type="submit" name="btnreset" id="btnreset" value="Xóa dữ liệu nhập vào">
                </div>
            </form>
        </div>

    </body>
</html>
